package controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import java.io.File;
import java.util.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;

import dao.*;
import entity.*;
import java.util.*;

@Controller
@RequestMapping("/feiji")
public class FeijiController extends BaseController {
	@Resource
	FeijiMapper dao;

	@RequestMapping("/add")
	public String add(Feiji data, HttpServletRequest request) {
		dao.insert(data);
		return "redirect:show.do";
	}

	@RequestMapping("/del")
	public String del(int id) {
		dao.deleteByPrimaryKey(id);
		return "redirect:show.do";
	}

	@RequestMapping("/modify")
	public String modify(int id, HttpServletRequest request) {
		Feiji record = dao.selectByPrimaryKey(id);
		request.setAttribute("record", record);
		return "admin/feiji";
	}

	@RequestMapping("/update")
	public String update(Feiji data) {
		dao.updateByPrimaryKey(data);
		return "redirect:show.do";
	}

	@RequestMapping("/show")
	public String show(HttpServletRequest request) {
		List all = dao.show();
		request.setAttribute("all", all);
		return "admin/feiji_list";
	}
}
